import { Controller, Post, Body } from '@nestjs/common';
import { AuthService } from './auth.service';

@Controller('login')
export class AuthController {
  constructor(private authService: AuthService) {}

  @Post()
  async login(@Body() body: { username: string; password: string }) {
    // 验证用户名和密码（伪代码）
    const user = { username: body.username, sub: 1 };
    return {
      access_token: await this.authService.generateToken(user),
    };
  }
}
